package com.tencent.sr.iris.basic.mp.restapi;

import com.tencent.sr.iris.basic.mp.service.IrisCommonKvConfigService;
import com.tencent.sr.iris.basic.service.interfaces.dto.TCommonKvConfigDTO;
import com.tencent.sr.iris.basic.service.interfaces.request.TCommonKvConfigBatchQueryRequest;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiaojun
 */
@Slf4j
@RestController
@Api("KV配置服务")
@RequestMapping("/iris/basic/mp/v1/commonKV")
public class IrisCommonKvConfigController {

    @Resource
    private IrisCommonKvConfigService irisCommonKvConfigService;

    @ApiOperation("查询kv配置，10s缓存（C端调用）")
    @PostMapping("/batchQuery")
    public HttpResult<List<TCommonKvConfigDTO>> batchQueryCommonKV(
            @Validated @RequestBody TCommonKvConfigBatchQueryRequest request) {
        return irisCommonKvConfigService.batchQueryCommonKV(request);
    }


}
